package top.zuli.package01.class15;

import org.junit.Test;

import java.util.Arrays;

public class Demo2 {
    @Test
    public void StringMethodTest2() throws Exception{
        //字符串转大写
        System.out.println("abc".toUpperCase());
        //字符串转小写
        System.out.println("ABC".toLowerCase());
        //根据平台默认编码将字符串转为字节数组
        byte[] bytes = "胖叔讲java".getBytes();
        System.out.println(Arrays.toString(bytes));
        //将字符串按照指定编码转为字节数组
        byte[] bytes2 = "胖叔讲java".getBytes("gbk");
        System.out.println(Arrays.toString(bytes2));
        //将字符串转为char数组
        char[] chars = "胖叔讲java".toCharArray();
        System.out.println(Arrays.toString(chars));
    }
}

/*
public class Demo2 {
    @Test
    public void StringMethodTest2() throws Exception{
        System.out.println("abc".toUpperCase());
        System.out.println("ABC".toLowerCase());
        byte[] bytes = "祖力皮喀尔".getBytes();
        System.out.println(Arrays.toString(bytes));
        byte[] bytes1 = "祖力皮喀尔".getBytes("gbk");
        System.out.println(Arrays.toString(bytes1));
        char[] chars = "祖力皮喀尔".toCharArray();
        System.out.println(Arrays.toString(chars));
        byte[] bytes2 = {1,2,3};
        System.out.println(bytes2);
        System.out.println(Arrays.toString(bytes2));

    }
}
*/

/*
public class Demo2 {
    @Test
    public void StringMethodTest2() throws Exception{
        System.out.println("zili".toUpperCase());
        System.out.println("ZULI".toLowerCase());
        byte[] bytes = "祖力皮喀尔".getBytes();
        System.out.println(Arrays.toString(bytes));
        byte[] bytes1 = "祖力皮喀尔".getBytes("gbk");
        System.out.println(Arrays.toString(bytes1));
        char[] chars = "祖力皮喀尔".toCharArray();
        System.out.println(Arrays.toString(chars));
    }
}
*/
